package com.itbaizhan.springboottask;

import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;

import java.util.concurrent.Executors;

/*线程池*/
@Configuration
public class ScheduledConfig implements SchedulingConfigurer {
    @Override
    public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) {
        //创建线程池 规定是这样写， 创建多小个线程池，自己定义
        scheduledTaskRegistrar.setScheduler(Executors.newScheduledThreadPool(5));
    }
}
